home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / sbrkout.c < prev    next >
C/C++ Source or Header  |  2000-05-13  |  3KB  |  112 lines

  1. /***************************************************************************
  2.  
  3.   vidhrdw.c
  4.  
  5.   Functions to emulate the video hardware of the machine.
  6.  
  7.   CHANGES:
  8.   MAB 05 MAR 99 - changed overlay support to use artwork functions
  9. ***************************************************************************/
  10.  
  11. #include "driver.h"
  12. #include "vidhrdw/generic.h"
  13. #include "artwork.h"
  14.  
  15. unsigned char *sbrkout_horiz_ram;
  16. unsigned char *sbrkout_vert_ram;
  17.  
  18. /* The first entry defines the color with which the bitmap is filled initially */
  19. /* The array is terminated with an entry with negative coordinates. */
  20. /* At least two entries are needed. */
  21. static const struct artwork_element sbrkout_ol[] =
  22. {
  23.     {{208, 247,   8, 217}, 0x20, 0x20, 0xff,   OVERLAY_DEFAULT_OPACITY},    /* blue */
  24.     {{176, 207,   8, 217}, 0xff, 0x80, 0x10,   OVERLAY_DEFAULT_OPACITY},    /* orange */
  25.     {{144, 175,   8, 217}, 0x20, 0xff, 0x20,   OVERLAY_DEFAULT_OPACITY},    /* green */
  26.     {{ 96, 143,   8, 217}, 0xff, 0xff, 0x20,   OVERLAY_DEFAULT_OPACITY},    /* yellow */
  27.     {{ 16,    23,   8, 217}, 0x20, 0x20, 0xff,   OVERLAY_DEFAULT_OPACITY},    /* blue */
  28.     {{-1,-1,-1,-1},0,0,0,0}
  29. };
  30.  
  31.  
  32. /***************************************************************************
  33. ***************************************************************************/
  34.  
  35. int sbrkout_vh_start(void)
  36. {
  37.     int start_pen = 2;    /* leave space for black and white */
  38.  
  39.     if (generic_vh_start()!=0)
  40.         return 1;
  41.  
  42.     overlay_create(sbrkout_ol, start_pen, Machine->drv->total_colors-start_pen);
  43.  
  44.     return 0;
  45. }
  46.  
  47. /***************************************************************************
  48.  
  49.   Draw the game screen in the given osd_bitmap.
  50.   Do NOT call osd_update_display() from this function, it will be called by
  51.   the main emulation engine.
  52.  
  53. ***************************************************************************/
  54. void sbrkout_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
  55. {
  56.     int offs;
  57.     int ball;
  58.  
  59.  
  60.     if (palette_recalc() || full_refresh)
  61.     {
  62.         memset(dirtybuffer,1,videoram_size);
  63.     }
  64.  
  65.     /* for every character in the Video RAM, check if it has been modified */
  66.     /* since last time and update it accordingly. */
  67.     for (offs = videoram_size - 1;offs >= 0;offs--)
  68.     {
  69.         if (dirtybuffer[offs])
  70.         {
  71.             int code,sx,sy,color;
  72.  
  73.  
  74.             dirtybuffer[offs]=0;
  75.  
  76.             code = videoram[offs] & 0x3f;
  77.  
  78.             sx = 8*(offs % 32);
  79.             sy = 8*(offs / 32);
  80.  
  81.             /* Check the "draw" bit */
  82.             color = ((videoram[offs] & 0x80)>>7);
  83.  
  84.             drawgfx(tmpbitmap,Machine->gfx[0],
  85.                     code, color,
  86.                     0,0,sx,sy,
  87.                     &Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  88.         }
  89.     }
  90.  
  91.     /* copy the character mapped graphics */
  92.     copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  93.  
  94.     /* Draw each one of our three balls */
  95.     for (ball=2;ball>=0;ball--)
  96.     {
  97.         int sx,sy,code;
  98.  
  99.  
  100.         sx = 31*8-sbrkout_horiz_ram[ball*2];
  101.         sy = 30*8-sbrkout_vert_ram[ball*2];
  102.  
  103.         code = ((sbrkout_vert_ram[ball*2+1] & 0x80) >> 7);
  104.  
  105.         drawgfx(bitmap,Machine->gfx[1],
  106.                 code,1,
  107.                 0,0,sx,sy,
  108.                 &Machine->drv->visible_area,TRANSPARENCY_PEN,0);
  109.     }
  110. }
  111.  
  112.